<?php
	require_once(dirname(__FILE__)."/../include/admin/users_data.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh" xml:lang="zh">
<head>
	<title>用户管理</title>
</head>
<body>
	<h1>用户管理:</h1>
	<form action="#" method="post">
		<span>关键字:</span>
		<input type="text" name="keyword" value="<?php echo $keyword; ?>" />
		<input type="submit" name="query" value="查询" />
		<span style="color: red">[关键字采用模糊匹配，可以是用户名，别名，邮箱]</span>
	</form>
	<br />
	<table style="width:80%; text-align:center" border="1" cellspacing="0" cellpadding="0">
		<tr>
			<th>用户名</th>
			<th>别名</th>
			<th>邮箱</th>
			<th>用户权限</th>
			<th>操作</th>
		</tr>
		<?php 
	foreach($PageArray["userlist"] as $Object){
?>
		<form action="#" method="post">
			<input type="hidden" name="keyword" value="<?php echo $keyword; ?>" />
			<input type="hidden" name="username" value="<?php echo $Object->username; ?>" />
			<tr>
				<td>
					<a href="../userinfo.php?user=<?php echo urlencode($Object->username);?>">
					 <?php echo $Object->username; ?></a>
				</td>
				<td>
					<?php echo $Object->nickname; ?></td>
				<td>
					<?php echo $Object->email; ?></td>
				<td>
					<select name = "permission">
<?php
	if($Object->permission == "admin")
	{
		echo "<option>admin</option>";
		echo "<option>user</option>";
	}
	else 
	{
		echo "<option>user</option>";
		echo "<option>admin</option>";
	}
?>
					</select>
				</td>
				<td>
					<input type="submit" name="update" value="更新" />
					&nbsp;&nbsp;
					<input type="submit" name="delete" value="删除用户" />
				</td>
			</tr>
		</form>
		<?php } ?>
	</table>
</body>
</html>